<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/view/common/header-talent.jspf"%>
<center>
	<h1>求职者主页</h1>
</center>
<hr>
<table class="table">
	<caption>
		<strong>一、简历管理：</strong><a
			href="<%=request.getContextPath()%>/view/talent/resume-add.jsp">新增简历</a>
	</caption>
	<thead>
		<tr>
			<th>编号</th>
			<th>求职意向</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		<c:if test="${empty resumeList }">
			<tr>
				<td colspan="3" align="center">还没有创建简历~</td>
			</tr>
		</c:if>
		<c:if test="${!empty resumeList }">
			<c:forEach items="${resumeList }" var="resume" varStatus="v">
				<tr>
					<th scope="row">${v.count }</th>
					<td><a
						href="<%=request.getContextPath()%>/ResumeServlet?command=preupdate&id=${resume.id}">${resume.intention }</a></td>
					<td><a
						href="<%=request.getContextPath()%>/ResumeServlet?command=delete&id=${resume.id}"
						onclick="return confirm('是否删除？');">删除</a></td>
				</tr>
			</c:forEach>
		</c:if>
	</tbody>
</table>
<table class="table">
	<caption>
		<strong>二、求职信息：</strong>
	</caption>
	<thead>
		<tr>
			<th>编号</th>
			<th>求职意向</th>
			<th>申请职位</th>
			<th>所在公司</th>
			<th>申请时间</th>
			<th>审核状态</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		<c:forEach items="${pageModel.list }" var="application" varStatus="v">
			<tr>
				<th scope="row">${v.count }</th>
				<td>${application.resume$intention }</td>
				<td>${application.position$name }</td>
				<td>${application.company$name }</td>
				<td><fmt:formatDate value="${application.appTime }"
						pattern="yyyy-MM-dd HH:mm:ss" /></td>
				<td>
					<c:if test="${application.status == 1 }">
						${application.statusStr }
					</c:if>
					<c:if test="${application.status != 1 }">
						${application.statusStr }
						(<fmt:formatDate value="${application.handleTime }" pattern="yyyy-MM-dd HH:mm:ss" />)
					</c:if>
					
					<%--  jstl-> if 
			          <c:if test="${application.status == 1 }">
			          		待审核
			          </c:if>
			          <c:if test="${application.status == 2 }">
			          		审核通过
			          </c:if>
			          <c:if test="${application.status == 3 }">
			          		已拒绝
			          </c:if>
			           --%> 
			           
			      <%--  jstl-> if...else
			          <c:choose>
						<c:when test="${application.status == 1 }">
			           	 	  待审核
			           	  </c:when>
						<c:otherwise>
							<c:when test="${application.status == 2 }">
				           	 	 审核通过
				           	  </c:when>
							<c:otherwise>
				           	  	 已拒绝
				           	  </c:otherwise>
						</c:otherwise>
					</c:choose>
				  --%>
				</td>
				<td><a
					href="<%=request.getContextPath()%>/ApplicationServlet?command=delete&id=${application.id}"
					onclick="return confirm('是否删除？');">删除</a></td>
			</tr>
		</c:forEach>
		<tr>
			<td colspan="7" align="right">
				<a href="<%=request.getContextPath()%>/ApplicationServlet?command=listTalentApplyByPage&pageNo=${pageModel.first}">首页</a>&nbsp;
				<a href="<%=request.getContextPath()%>/ApplicationServlet?command=listTalentApplyByPage&pageNo=${pageModel.pre}">上一页</a>&nbsp;
				第<select onchange="goPage(this)">
				 	<script>
				 		var pageNo = '${pageModel.pageNo }';
				 		var totalPage = '${pageModel.totalPage }';
				 		for (var i = 1; i <= totalPage; i++) {
				 			if (pageNo == i) {
				 				document.write('<option value="' + i + '" selected="selected">' + i + '</option>');
				 			} else {
				 				document.write('<option value="' + i + '">' + i + '</option>');
				 			}
				 		}
				 	</script>
				 </select>页
				,共${pageModel.totalPage }页&nbsp;
				<a href="<%=request.getContextPath()%>/ApplicationServlet?command=listTalentApplyByPage&pageNo=${pageModel.next}">下一页</a>&nbsp;
				<a href="<%=request.getContextPath()%>/ApplicationServlet?command=listTalentApplyByPage&pageNo=${pageModel.last}">尾页</a>&nbsp;
				共${pageModel.allRecords }条记录
			</td>
		</tr>
	</tbody>
</table>
<%@ include file="/view/common/footer.jspf"%>
<script>
	/**
	 * 信息操作框
	 */
	toastr.options = {
	  "closeButton": true,
	  "debug": false,
	  "positionClass": "toast-top-right",
	  "onclick": null,
	  "showDuration": "300",
	  "hideDuration": "1000",
	  "timeOut": "3000",
	  "extendedTimeOut": "1000",
	  "showEasing": "swing",
	  "hideEasing": "linear",
	  "showMethod": "fadeIn",
	  "hideMethod": "fadeOut"
	}
	if ('${success }') {
		toastr.success('${success }');
	}
	if ('${error }') {
		toastr.error('${error }');
	}
	
	/**
	 * 跳转到指定的页数
	 */
	function goPage(obj) {
		location = '<%=request.getContextPath()%>/ApplicationServlet?command=listTalentApplyByPage&pageNo=' + obj.value;
	}
</script>